<?php

class Person extends CActiveRecord
{
    public $id;

    public $firstname;

    public $lastname;

    public $phone;

    public $email;

    public $video;

    public $available;

    public $age;

    public $sex;

    public $birthdate;

    public $mother_language;

    public $other_languages;

    public $availability;

    public $upload;

    public function tableName()
    {
        return 'people';
    }

    public function relations()
    {
        return array(
            'user' => array(self::BELONGS_TO, 'User', 'user_id'),
            'residence' => array(self::BELONGS_TO, 'Country', 'residence_id'),
            'citizenship' => array(self::BELONGS_TO, 'Country', 'citizenship_id')
        );
    }

    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    public function getFullName()
    {
        return $this->firstname . ' ' . $this->lastname;
    }

    public function getImage()
    {
        return $this->id . '.jpg';
    }
}